<template>
    <div>
        <strong style="font-size: large">共{{list.length}}篇</strong>
        <a-list style="margin-top: 10px">
            <a-list-item v-for="i in list" :key="i.id">
                <a-list-item-meta>
                    <a slot="title" target="_blank" style="font-weight: bold" :href="'https://jxjlife.cn/article/'+i.id">{{i.title}}</a>
                </a-list-item-meta>
                <a-button size="small" @click="unFavor(i.id)">取消收藏</a-button>
            </a-list-item>
        </a-list>
    </div>
</template>

<script>
    export default {
        name: "Favor",
        data(){
            return{
                list: [],
            }
        },
        created() {
            this.getData();
        },
        methods:{
            getData(){
                const t = this;
                axios.get('/atc/getMyFavor').then(function (resp) {
                    t.list = resp.data;
                })
            },
            unFavor(id){
                const t = this;
                axios.get('/do/unFavor?id='+id).then(function (resp) {
                    t.getData();
                    t.$message.success('已取消');
                })
            }
        }
    }
</script>

<style scoped>

</style>